﻿@model AddProjectModel
@{
    bool isNew = ViewBag.isNew;
    string messageUrl, projectUrl;
    if (isNew)
    {
        messageUrl = Url.Action("AddMessage", null, null, "http");
        projectUrl = Url.Action("AddProject", null, null, "http");
    }
    else
    {
        messageUrl = Url.Action("AddMessage2", null, null, "http");
        projectUrl = Url.Action("AddProject2", null, null, "http");
    }
}
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN VALIDATION STATES-->
        <div class="portlet box green">
            <div class="portlet-title">
                <div class="caption">
                    <i class="fa fa-reorder"></i>@ViewBag.TableTitle
                </div>
                <div class="tools">
                </div>
            </div>
            <div class="portlet-body form">
                <div class="portlet-body">
                    <ul class="nav nav-tabs">
                        <li class="" data-url="@messageUrl">
                            <a data-toggle="tab">發送推送消息</a>
                        </li>
                        <li class="active" data-url="@projectUrl">
                            <a data-toggle="tab">添加項目信息</a>
                        </li>
                    </ul>
                    <div class="tab-content">
                        <div class="tab-pane fade active in" id="tab_1_1">
                            <!-- BEGIN FORM-->
                            @using (Html.BeginForm(null, null, null, FormMethod.Post, new
                            {
                                @class = "form-horizontal",
                                @novalidate = "novalidate",
                                @enctype = "multipart/form-data"
                            }))
                            {
                                @Html.AntiForgeryToken()
                                @Html.Partial("_Tip")
                                @*@Html.Partial("_ChooseServer")*@

                                <div class="form-group">
                                    <label class="control-label col-md-3">AppName&nbsp;&nbsp;</label>
                                    <div class="col-md-4">
                                        @Html.TextBoxFor(s => s.AppName, new { @class = "form-control" })
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">IOS测试證書</label>
                                    <div class="col-md-9">
                                        <div class="fileupload fileupload-new" data-provides="fileupload">
                                            <div class="input-group">
                                                <span class="input-group-btn">
                                                    <span class="uneditable-input">
                                                        <i class="fa fa-file fileupload-exists"></i>
                                                        <span class="fileupload-preview">
                                                        </span>
                                                    </span>
                                                </span>
                                                <span class="btn default btn-file">
                                                    <span class="fileupload-new">
                                                        <i class="fa fa-paper-clip"></i> Select file
                                                    </span>
                                                    <span class="fileupload-exists">
                                                        <i class="fa fa-undo"></i> Change
                                                    </span>
                                                    <input type="file" name="sandbox_certUrl" />
                                                </span>
                                                <a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash-o"></i> Remove</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">IOS測試密碼</label>
                                    <div class="col-md-4">
                                        @Html.TextBoxFor(s=>s.SandBoxPassWord,new{@class="form-control"})
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">IOS正式證書</label>
                                    <div class="col-md-9">
                                        <div class="fileupload fileupload-new" data-provides="fileupload">
                                            <div class="input-group">
                                                <span class="input-group-btn">
                                                    <span class="uneditable-input">
                                                        <i class="fa fa-file fileupload-exists"></i>
                                                        <span class="fileupload-preview">
                                                        </span>
                                                    </span>
                                                </span>
                                                <span class="btn default btn-file">
                                                    <span class="fileupload-new">
                                                        <i class="fa fa-paper-clip"></i> Select file
                                                    </span>
                                                    <span class="fileupload-exists">
                                                        <i class="fa fa-undo"></i> Change
                                                    </span>
                                                    <input type="file" name="certurl">
                                                </span>
                                                <a href="#" class="btn red fileupload-exists" data-dismiss="fileupload"><i class="fa fa-trash-o"></i> Remove</a>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">IOS密碼</label>
                                    <div class="col-md-4">
                                        @Html.TextBoxFor(s => s.PassWord, new { @class = "form-control" })
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">SenderId&nbsp;&nbsp;</label>
                                    <div class="col-md-6">
                                        @Html.TextAreaFor(s => s.SenderId, new { @class = "form-control", @rows = "6" })
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">AuthorizationToken &nbsp;&nbsp;</label>
                                    <div class="col-md-6">
                                        @Html.TextAreaFor(s => s.AuthorizationToken, new { @class = "form-control", @rows = "6" })
                                    </div>
                                </div>

                                <div class="form-group">
                                    <label class="control-label col-md-3">PackageName&nbsp;&nbsp;</label>
                                    <div class="col-md-6">
                                        @Html.TextAreaFor(s => s.PackageName, new { @class = "form-control", @rows = "6" })
                                    </div>
                                </div>

                                <div class="form-actions fluid">
                                    <div class="col-md-offset-3 col-md-9">
                                        <button type="submit" class="btn green">Submit</button>
                                    </div>
                                </div>
                            }
                            <!-- END FORM-->
                        </div>
                    </div>
                </div>
            </div>
            <!-- END VALIDATION STATES-->
        </div>
    </div>
</div>

@section script{
    @*<script src="~/assets/zrjs/user/edit.js"></script>*@
    <script>
        $(function () {
            //FormValidation.init();
            FormComponents.init();

            //點擊導航菜單時,切換頭部導航
            $('.nav.nav-tabs li')
                .each(function (i, e) {
                    $(e)
                        .on('click',
                            function () {
                                var url = $(this).attr('data-url');
                                if (!!url && location.href.toLowerCase() != url.toLowerCase())
                                    location.href = url;
                            });
                });
        })
    </script>
}